﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.Serialization;

namespace ModelLayer
{
    [DataContract]
    public class Flight
    {
        [DataMember]
        public int RouteId { get; set; }
        [DataMember]
        public double Price { get; set; }
        [DataMember]
        public Airport Departure { get; set; }
        [DataMember]
        public Airport Arrival { get; set; }

        public Flight()
        {
            
        }
        //Override equals to compare Flight object by their id
        public override bool Equals(object _obj)
        {
            bool equal = false;
            Flight objFlight = (Flight) _obj;

            if (this.RouteId.Equals(objFlight.RouteId))
            {
                equal = true;
            }
            return equal;
        }
        //Overrides toString to represent the object.
        public override string ToString()
        {
            return string.Format("RouteID: {0} \n Departure airport: {1} Arrival airport {2}", RouteId, Departure.AirportName, Arrival.AirportName);
        }
          
    }
}
